﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace ConsoleApp1.DbCustom.Models
{
    [Index(nameof(UserId), nameof(RoleId), Name = "AK_KEY_2_Sys_UserRole", IsUnique = true)]
    [Index(nameof(RoleId), Name = "Index_RoleId")]
    [Index(nameof(UserId), Name = "Index_UserId")]
    public partial class Sys_UserRole
    {
        [Key]
        [StringLength(36)]
        [Unicode(false)]
        public string Id { get; set; } = null!;
        [StringLength(36)]
        [Unicode(false)]
        public string UserId { get; set; } = null!;
        [StringLength(36)]
        [Unicode(false)]
        public string RoleId { get; set; } = null!;
        [StringLength(36)]
        [Unicode(false)]
        public string? CreatedBy { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? CreatedTime { get; set; }
        [StringLength(36)]
        [Unicode(false)]
        public string? LastModifiedBy { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? LastModifiedTime { get; set; }

        [ForeignKey(nameof(RoleId))]
        [InverseProperty(nameof(Sys_Role.Sys_UserRole))]
        public virtual Sys_Role Role { get; set; } = null!;
        [ForeignKey(nameof(UserId))]
        [InverseProperty(nameof(Sys_User.Sys_UserRole))]
        public virtual Sys_User User { get; set; } = null!;
    }
}
